<?php 
    $this->headScript()
        ;
?>

<?php $this->headStyle()->captureStart() ?>
#sortable { list-style-type: none; margin: 0; padding: 0; }
#sortable li {list-style:none; margin: 10px 0 10px 0; padding: 0.5em; padding-left: 1.5em; line-height: 26px; border:1px solid #ccc;}
#sortable li span.move {margin:6px 0 0 0; cursor:move;}
#sortable li span.del {margin:6px 0 0 0; cursor:pointer;}
<?php $this->headStyle()->captureEnd() ?>

<?php $this->headScript()->captureStart() ?>
$(document).ready(function(){
    $( "#sortable" ).sortable({
        opacity: 0.6,
        revert: true,
        cursor: 'move',
        handle: '.move', 
        update: function(event, ui){
            var newOrder = [];   
            $( "#sortable" ).find("input[name='recommendTagId']").each(function() {   
                newOrder.push(this.value);   
            });   
            //var newOrderIds = newOrder.join(',');   
            //var oldid = $orderlist.val();   
            $.ajax({   
                type: "post",   
                url: "<?php echo $this->url(array('module'=>'admin', 'controller'=>'blog-tag', 'action'=>'save-order'),'default',true) ?>",
                data: { newOrder: newOrder},
                beforeSend: function() {   

                },   
                success:function(responseText, statusText)
                {
                    //alert(responseText);
                    var json = jQuery.parseJSON(responseText);
                    if(json.result != 1){
                        dialogMessage(json.messages);
                        return false;
                    }
                    return true;
                }, 
             }); 
        }
    });

    $(".delete").live('click',function(){ 
        var recommendTagId   = $(this).attr("data-recommendTagId");
        var currRecommendTag = $("li[data-recommendTagId=" + recommendTagId + "]");
        //alert(currRecommendTag.html());
        
        dialogConfirm($.languages.areYouSureToDelete, function(){
            $.ajax({ 
                type: "POST", 
                url: "<?php echo $this->url(array('module'=>'admin', 'controller'=>'blog-tag', 'action'=>'delete-tag'),'default',true) ?>", 
                data: { recommendTagId : recommendTagId},
                success:function(responseText, statusText){
                    var json = jQuery.parseJSON(responseText);
                    if(json.result != 1){ 
                        dialogMessage(json.messages);
                        return false;
                    }

                    currRecommendTag.remove(); 
                    return true;
                } 
            });
        });
    }); 

    var options = { 
        type:"POST",
        dataType : "text",
        buttons:$('#mainForm').find("input[name='submit']"),
        async : true,
        cache: false,
        success:function(responseText, statusText)
        {
            //alert(responseText);
            var json = jQuery.parseJSON(responseText);
            
            if(json.result != 1){ 
                dialogMessage(json.messages);
                return false;
            }
            
            $( "#sortable" ).append(json.content); 
            
            return true;
        },
    };
    var v = jQuery("#mainForm").validate({
        debug: true,
        messages: {
            tagName: {
                required: "<?php echo $this->translate("Tag word is required.");?>",
            },
        },
        rules: {
            tagName: {
                required: true,
            },
        },
        errorPlacement: function(error, element) {
            var elementName = element.attr("name");
            var idTip = 'tip-' + elementName;
            $("#" + idTip).html(error);
        },
        success: function(label) {
            label.addClass("valid").text("Ok!")
        },
        submitHandler: function(form) {
            jQuery(form).ajaxSubmit(options);
        }
    });

});
<?php $this->headScript()->captureEnd() ?>

<div class="append-top prepend-top">
<?php echo $this->translate("Tag list");?>
<hr>
</div>
<div class="append-top prepend-top">
    <ul id="sortable"> 
    <?php if(is_array($this->tags)):?>
    <?php foreach ($this->tags as $tag):?>
        <?php 
        echo $this->partial('module_admin_script_recommend-tag-li.phtml', array(
                'tag' => $tag,
            ));
        ?>
    <?php endforeach;?>
    <?php endif;?>
    </ul>
</div>

<div class="append-top prepend-top">
<?php echo $this->translate("Add tag");?>
<hr>
</div>

<div class="append-top prepend-top">
    <form method="post" id="mainForm" name="mainForm" action="<?php echo $this->url(array('module'=>'admin', 'controller'=>'blog-tag', 'action'=>'save-tag'),'default',true) ?>">
    <div class="clearfix">
        <div class="column span-3">
            <span class="right"><?php echo $this->translate("Tag name");?>: </span>
        </div>
        <div class="column">
            <div class=""><input type="text" id="tagName" name="tagName" value="" class="text ui-widget-content ui-corner-all"><input type="submit" name="submit" id="submit" value="<?php echo $this->translate("Submit");?>"></div>
            <div class="tip" id="tip-tagName"><?php echo $this->translate("Tag word is required.");?></div>
        </div>
    </div>
    </form>
</div>
